package gocloak

import (
	
)

// HTTPErrorResponse is a model of an error response
type HTTPErrorResponse struct {
	Error       string `json:"error,omitempty"`
	Message     string `json:"errorMessage,omitempty"`
	Description string `json:"error_description,omitempty"`
}

// String returns a string representation of an error
func ( HTTPErrorResponse) () string {
	var  strings.Builder
	if len(.Error) > 0 {
		.WriteString(.Error)
	}
	if len(.Message) > 0 {
		if .Len() > 0 {
			.WriteString(": ")
		}
		.WriteString(.Message)
	}
	if len(.Description) > 0 {
		if .Len() > 0 {
			.WriteString(": ")
		}
		.WriteString(.Description)
	}
	return .String()
}

// NotEmpty validates that error is not emptyp
func ( HTTPErrorResponse) () bool {
	return len(.Error) > 0 || len(.Message) > 0 || len(.Description) > 0
}